var express = require("express");
var router = express.Router();
var fs = require("fs");
var { TextModel } = require("../db/db");
var CompareFace = require("../untils/face");

// 测试列表
router.get("/text_list", async (req, res) => {
  let pageIndex = req.query.pageIndex;
  let pageSize = req.query.pageSize;
  console.log(req.query);
  let list = [];
  let total = 0;
  list = await TextModel.find()
    .skip((pageIndex - 1) * pageSize)
    .limit(pageSize)
    .sort({ times: -1 })
    .exec();
  total = list.length;
  res.send({
    code: 200,
    msg: "展示成功",
    data: list,
    total: total,
  });
});


module.exports = router;
